package day_2022_9_to_12.Day;

/**
 * @author haomin
 * @date 2022/11/03 17:19
 **/
public class Day61_1_Num1668_MaxRepeating {
    class Solution {
        public int maxRepeating(String s, String w) {
            int n = s.length(), m = w.length(), max = 0;
            int[] dp = new int[n+10];
            for(int i = 1; i <= n; ++i){
                if(i - m < 0) continue;
                if(s.substring(i-m, i).equals(w)) {
                    dp[i] = dp[i-m] + 1;
                    max = Math.max(max, dp[i]);
                }
            }
            return max;
        }
    }
}